/*
 * @(#)ParserScan.java 1.00 07 Ago 2007
 *
 * Copyright (c) 2005-2007 Soluciones Info Móviles S.A.C.
 * Av. Javier Prado Oeste 203 - Piso 13, Lima 27, Perú.
 * Todos los derechos reservados.
 */

package sim.utils.parser;

/**
 * Parser de información.
 *
 * @author Lobsang A. Szaler <l.alvites@lpcsite.com>
 * @since  1.0
 */
public interface ParserScan {

    /**
     *  A "callback" from Parser.
     *  This method is called each time Parser scan() finds the given token.
     *
     *  @param  hit     number of times the token was found in the line
     *  @param  line    array of byte containg the text to be parsed
     *  @param  start   byteArray offset where the found field starts
     *  @param  length  length of the new field to extract
     *
     *  @return boolean True to continue scanning for next tokens in the line or False to stop
     */    
    public boolean parserHit(int hit, final byte[] line, int start, int length, Object something);
    
    /**
     *  A "callback from Parser.
     *  Ths method is automatically called after Parser scan() has finished
     *  parsing the whole line. Here you can implement your code to do specific
     *  tasks each time a line has finished parsing a line.
     *
     * @param cancel 
     */    
    public boolean parserEnd(boolean cancel);
    
}
